/*    */ package com.chw.admin.materiel;
/*    */ 
/*    */ import com.chw.utils.CommonFieldsUtil;
/*    */ import com.chw.utils.UUIDUtil;
/*    */ import com.github.pagehelper.PageHelper;
/*    */ import com.github.pagehelper.PageInfo;
/*    */ import java.util.List;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Service;
/*    */ 
/*    */ @Service
/*    */ public class ChwMaterielService
/*    */   implements IChwMaterielService
/*    */ {
/*    */ 
/*    */   @Autowired
/*    */   private ChwMaterielMapper chwMaterielMapper;
/*    */ 
/*    */   public PageInfo<ChwMateriel> find(ChwMateriel chwMateriel, Integer currentPage, Integer pageSize)
/*    */   {
/* 20 */     PageHelper.startPage(currentPage.intValue(), pageSize.intValue());
/* 21 */     List list = this.chwMaterielMapper.findByChwMateriel(chwMateriel);
/* 22 */     return new PageInfo(list);
/*    */   }
/*    */ 
/*    */   public int save(ChwMateriel chwMateriel)
/*    */   {
/*    */     try {
/* 28 */       chwMateriel.setMaterielId(UUIDUtil.getUUID());
/* 29 */       CommonFieldsUtil.setCreateValueByCy(chwMateriel);
/* 30 */       this.chwMaterielMapper.insert(chwMateriel);
/* 31 */       return 0;
/*    */     } catch (Exception e) {
/* 33 */       e.printStackTrace();
/*    */     }
/* 35 */     return 1;
/*    */   }
/*    */ 
/*    */   public int delVendor(String id)
/*    */   {
/*    */     try {
/* 41 */       ChwMateriel chwMateriel = this.chwMaterielMapper.selectByPrimaryKey(id);
/* 42 */       chwMateriel.setEnabledFlag("N");
/* 43 */       this.chwMaterielMapper.updateByPrimaryKey(chwMateriel);
/* 44 */       return 0;
/*    */     } catch (Exception e) {
/* 46 */       e.printStackTrace();
/*    */     }
/* 48 */     return 1;
/*    */   }
/*    */ 
/*    */   public ChwMateriel findById(String id)
/*    */   {
/* 53 */     return this.chwMaterielMapper.selectByPrimaryKey(id);
/*    */   }
/*    */ 
/*    */   public int update(ChwMateriel chwMateriel)
/*    */   {
/*    */     try {
/* 59 */       CommonFieldsUtil.setCreateValueByCy(chwMateriel);
/* 60 */       this.chwMaterielMapper.updateByPrimaryKey(chwMateriel);
/* 61 */       return 0;
/*    */     } catch (Exception e) {
/* 63 */       e.printStackTrace();
/*    */     }
/* 65 */     return 1;
/*    */   }
/*    */ }

/* Location:           E:\chenya\haha\admin java\materiel\
 * Qualified Name:     com.chw.admin.materiel.ChwMaterielService
 * JD-Core Version:    0.6.0
 */